function require(url) {
    var rest = null;
    $.ajax({
        url: url,
        method: 'get',
        async: false,
        success: function(res) {
            rest = res;
        }
    })
    return rest;
}
console.log(require('views/test.vue'));

const item1 = {
    template: "#item1"
}
const item2 = {
    template: "<h1>我是命名路由内容</h1>"
}
const item3 = {
    template: "#item3"
}
const item = {
    template: "<h1>我是动态路由内容</h1>"
}
const child1 = {
    template: "<h1>我是child1内容</h1>"
}
const child2 = {
    template: "<h1>我是child2内容</h1>"
}
const child3 = {
    template: "#child3"
}
const test1 = {
    template: "<h1>我是childChild1内容</h1>"
}
const test2 = {
    template: "<h1>我是childChild2内容</h1>"
}
const test3 = {
    template: "<h1>我是childChild3内容</h1>"
}
const routes = [{
    path: "/item1",
    component: item1
}, {
    path: "/item2",
    name: "item2",
    component: item2
}, {
    path: "/item3",
    component: item3,
    children: [{
        path: "/item3/child1",
        component: child1
    }, {
        path: "/item3/child2",
        component: child2
    }, {
        path: "/item3/child3",
        component: child3,
        children: [{
            path: "/item3/child3/test1",
            component: test1
        }, {
            path: "/item3/child3/test2",
            component: test2
        }, {
            path: "/item3/child3/test3",
            component: test3
        }, {
            path: '/item3/child3/',
            redirect: "/item3/child3/test1"
        }]
    }, {
        path: '/item3/',
        redirect: '/item3/child1'
    }]
}, {
    path: "/item/:id",
    component: item
}, {
    path: '/',
    redirect: '/item1'
}]
const router = new VueRouter({
    routes // （缩写）相当于 routes: routes
})
new Vue({
    el: "#box",
    router,
    watch: {
        $route(to, from) {
            // to表示的是你要去的那个组件，from 表示的是你从哪个组件过来的，它们是两个对象，你可以把它打印出来，它们也有一个param 属性
            console.log("toName", to.fullPath, " --- ", to.params.id);
            console.log("fromName", from.fullPath, " --- ", from.params.id);
            // console.log(from);
            this.dynamicSegment = to.params.id
        }
    }

})